package book;

// book interface 
public interface Book 
{	
	BookName returnBooksName();
	AuthorName returnBooksAuthor();
	Year returnPublishingYear();
	Version returnVersion();
	ISBN returnISBN();
}





/**************************************/
/* Book's Name Classes. Two available formats
 * 
 */
abstract class BookName
{
	protected String name;
	abstract String returnName();
}

class BookNameFormat1 extends BookName
{
	BookNameFormat1(String name)
	{
		this.name = name;
	}
	
	public String returnName() {return "Book's name: " + name;} 
}

class BookNameFormat2 extends BookName
{
	BookNameFormat2(String name)
	{
		this.name = name;
	}
	
	public String returnName() {return name;}
}

/********************************************/
/* Author's Name classes. Only one format for now.
 */
abstract class AuthorName
{
	protected String[] names;
	abstract String returnNames();
}

class AuthorNameFormat1 extends AuthorName
{
	AuthorNameFormat1(String[] names)
	{
		this.names = new String[names.length];
		for (int i = 0; i < names.length; i++)
		{
			this.names[i] = names[i];
		}
	}
	
	public String returnNames() 
	{
		String temp = "";
		for (int i = 0; i < names.length; i++)
		{
			temp += names[i] + ", ";
		}
		return temp;
	}
}

/****************************************/
/* Publishing Year classes.
 * Two formats available.
 */

abstract class Year
{
	protected int year;
	abstract String returnYear();
}

class YearFormat1 extends Year
{
	YearFormat1(int year)
	{
		this.year = year;
	}
	
	public String returnYear() {return "Year of publishing: " + Integer.toString(year);} 
}

class YearFormat2 extends Year
{
	YearFormat2(int year)
	{
		this.year = year;
	}
	
	public String returnYear() {return Integer.toString(year) + ".";}
}

/******************************************/
abstract class Version
{
	protected int version;
	abstract String returnVersion();
}

class VersionFormat1 extends Version
{
	VersionFormat1(int version)
	{
		this.version = version;
	}
	
	public String returnVersion() {return Integer.toString(version);}
}

/*********************************************/
abstract class ISBN
{
	protected String isbn;
	abstract String returnISBN();
}

class ISBNFormat1 extends ISBN
{
	ISBNFormat1(String isbn) {this.isbn = isbn;}
	public String returnISBN() {return isbn;}
}

